#
# This script will in stall the files needed for creating users in the enchroot jail.
#
# For your shell to find these files you need to set up your path like...
# export PATH="/usr/local/sbin:$PATH"
# This would typically be done in your $HOME/.profile file.
#
# enchroot is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# enchroot is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Lesser Public License for more details.
#
# You should have received a copy of the GNU Lesser Public License
# along with enchroot. If not, see <http://www.gnu.org/licenses/>.
#
# Copyright (c) 2010 charles@kollar.com
#

INSTALLDIR=/usr/local/sbin
INSTALLSHELLDIR=/usr/local/bin
INSTALLETC=/usr/local/etc

CP=/bin/cp
CHMOD=/bin/chmod

RM=/bin/rm

install:
	if ! [ -d $(INSTALLDIR) ] ; then  mkdir -p $(INSTALLDIR); fi
	$(CP) ./create_chroot ./patch_chroot ./addprog_chroot ./delete_chroot ./addmysqluser_chroot $(INSTALLDIR)
	if ! [ -d $(INSTALLSHELLDIR) ] ; then  mkdir -p $(INSTALLSHELLDIR); fi
	$(CP) ./chroot_shell ./mysql_shell  $(INSTALLSHELLDIR)
	$(CHMOD) 755 $(INSTALLSHELLDIR)/chroot_shell $(INSTALLSHELLDIR)/mysql_shell
	if ! [ -d $(INSTALLETC) ] ; then  mkdir -p $(INSTALLETC); fi
	$(CP) ./aide.conf ./enchroot.conf $(INSTALLETC)
	echo "Remember to put /usr/local/sbin in your path"

uninstall:
	$(RM) -f $(INSTALLDIR)/create_chroot $(INSTALLDIR)/patch_chroot $(INSTALLDIR)/addprog_chroot $(INSTALLDIR)/delete_chroot $(INSTALLDIR)/addmysqluser_chroot
	$(RM) -f $(INSTALLSHELLDIR)/chroot_shell $(INSTALLSHELLDIR)/mysql_shell
	$(RM) -f $(INSTALLETC)/aide.conf $(INSTALLETC)/enchroot.conf
